/*
 * TitleBar.fx
 *
 * Created on 2009-02-27, 13:24:46
 */

package pl.koziolekweb.prezentacja4developers;

import javafx.scene.CustomNode;
import javafx.scene.Group;
import javafx.scene.Node;
import javafx.scene.paint.Color;
import javafx.scene.shape.Rectangle;
import javafx.scene.text.Font;
import javafx.scene.text.Text;
import javafx.scene.image.ImageView;
import javafx.scene.image.Image;

/**
 * @author bartlomiejk
 */

public class TitleBar extends CustomNode {

    public var currentHeight: Float;
    public var currentWidth: Float;
    public var title: String;
    public var font: Font = Font{
        size: 0
    }
    public var image: String;

    var img:Image = Image {
                        url: image
                    }

    public override function create(): Node {
        return Group {
            translateY: 0
            content: [
                Rectangle {
                    x: 0,
                    y: 0
                    width: bind currentWidth,
                    height: bind 0.1 * currentHeight,
                    fill: Color.BLACK
                }
                Text {
                    font: bind font
                    x: 10
                    y: bind this.font.size
                    content: bind title
                    fill: Color.RED
                }
                ImageView {
                    image: bind img
                    x: bind currentWidth - this.img.width
                    y: bind 0.005 * currentWidth
                    fitHeight: bind 0.09 * currentHeight
                }
            ]
        };
    }
}
